package com.itHuangTao.tank.introduce;

import com.almasb.fxgl.app.scene.FXGLMenu;
import com.almasb.fxgl.app.scene.MenuType;
import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.texture.Texture;
import com.itHuangTao.tank.ui.HelpMenu;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;

public class Creater extends FXGLMenu {
    public Creater() {
        super(MenuType.GAME_MENU);
        //设置背景图
        Texture texture = FXGL.texture("background.png");
        //设置文本介绍
        Text text = new Text("\nTank 1990是黄某与雷某合作设计的一款具有\n" +
                "多元化场景、多重关卡、多种玩法、\n" +
                "充满惊喜道具和复杂策略战斗意识的\n"
                + "坦克大战小游戏\n"
                + "\n"
                + "游戏地图美化及玩法设计：雷某 、黄某\n" +
                "游戏玩法代码逻辑设计：黄某\n");
        text.setFill(Color.RED);
        text.setFont(new Font("微软雅黑", 26));

        StackPane pane = new StackPane(texture, text);
        //设置窗口大小
        pane.setPrefSize(FXGL.getAppWidth(), FXGL.getAppHeight());
        //设置背景色(黑色)
        pane.setStyle("-fx-background-color: black");

        //按钮属性
        Button btnReturnLastMenu = new Button("返回上一级");
        btnReturnLastMenu.getStyleClass().add("menu-btn");//利用css设置样式
        btnReturnLastMenu.setOnAction(event -> {
            FXGL.getSceneService().pushSubScene(new HelpMenu());
        });

        //存放按钮属性
        VBox box = new VBox(30, btnReturnLastMenu);
        box.setLayoutX(FXGL.getAppWidth() / 2.0 - 50);
        box.setLayoutY(450);

        getContentRoot().getChildren().addAll(pane, box);
    }
}
